package top.datacluster.basic.algorithm.leetcode.bit;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class LeetCode49 {

    public List<List<String>> groupAnagrams(String[] strs) {
        return Arrays.stream(strs).collect(Collectors.groupingBy(s->{
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            return new String(chars);
        })).values().stream().collect(Collectors.toList());
    }
}
